package com.fulin.thread.task;

/**
*
* @description 
* @auther fulin16@crnet.com.hk
* @since 2020年1月16日 下午6:11:29
*
*/

public class TestCountDown {
	public static void main(String[] args) throws InterruptedException {
		new Thread() {
			public void run() {
				int i = 0;
				while(i < 7) {
					System.out.println("t1 => " + CountDownHandler.latch.getCount());
					CountDownHandler.latch.countDown();
					i ++;
				}
			}
		}.start();
//		Thread.sleep(500L);
		System.out.println(CountDownHandler.latch.getCount());
		
		new Thread() {
			public void run() {
				int i = 0;
				while(i < 7) {
					System.out.println("t2 => " + CountDownHandler.latch.getCount());
					CountDownHandler.latch.countDown();
					i ++;
				}
			}
		}.start();
		
		Thread.sleep(500L);
		System.out.println(CountDownHandler.latch.getCount());
	}
}
